//
//  ViewController.m
//  10611
//
//  Created by student on 16/3/5.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

#import "Masonry.h"

// 定义之后可以不用带mas_前缀
#define MAS_SHORTHAND
// 定义之后equalTo等于mas_equalTo
#define MAS_SHORTHAND_GLOBALS

#define margin 20

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UIView *blueView = [[UIView alloc] init];
    blueView.backgroundColor = [UIColor blueColor];
    [self.view addSubview:blueView];
    UIView *redView = [[UIView alloc] init];
    redView.backgroundColor = [UIColor redColor];
    [self.view addSubview:redView];
    //蓝色View的约束
    [blueView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@50);
        make.left.equalTo(self.view.mas_left).offset(margin);
        make.bottom.equalTo(self.view.mas_bottom).offset(-margin);
        make.trailing.equalTo(redView.mas_left).offset(-margin);
    }];
    //红色View的约束
    [redView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@50);
        make.right.equalTo(self.view.mas_right).offset(-margin);
        make.bottom.equalTo(self.view.mas_bottom).offset(-margin);
        make.leading.equalTo(blueView.mas_right).offset(margin);
    }];

    
   
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
